package com.zuqiuzhandui.liveing.view.chooseTeam;

import android.content.Intent;
import android.os.Bundle;
import android.os.Parcelable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.zuqiuzhandui.R;
import com.zuqiuzhandui.liveing.base.BaseActivity;
import com.zuqiuzhandui.liveing.model.resultModel.TeamListRs;


import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

public class ChooseTeamActivity extends BaseActivity {

    @BindView(R.id.rv_main)
    RecyclerView rvMain;

    private TeamAdapter mAdapter;

    @Override
    public void setViewId() {
        setContentView(R.layout.activity_choose_team);
    }

    @Override
    public void initView() {
        rvMain.setLayoutManager(new LinearLayoutManager(this));
    }

    @Override
    public void initData() {
    }

    @Override
    public void setMonter() {
        mAdapter.setOnRecyclerViewItemClickListener(new BaseQuickAdapter.OnRecyclerViewItemClickListener() {
            @Override
            public void onItemClick(View view, int i) {
                Intent intent=new Intent();
                Bundle bundle=new Bundle();
                bundle.putInt("index",i);
                intent.putExtra(BUNDLE_KEY,bundle);
                setResult(RESULT_OK,intent);
                finish();
            }
        });
    }

    @Override
    public void getBundle() {
        Bundle bundleExtra = getIntent().getBundleExtra(BUNDLE_KEY);
        ArrayList<TeamListRs> team = bundleExtra.getParcelableArrayList("team");
        mAdapter=new TeamAdapter(R.layout.item_team,team);
        rvMain.setAdapter(mAdapter);

    }
}
